BEGIN;
CREATE TABLE `entity_object` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL
)
;
CREATE TABLE `entity_int` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `obj_id` integer NOT NULL,
    `val` integer,
    UNIQUE (`cls_id`, `met_id`, `obj_id`)
)
;
CREATE TABLE `entity_float` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `obj_id` integer NOT NULL,
    `val` double precision,
    UNIQUE (`cls_id`, `met_id`, `obj_id`)
)
;
CREATE TABLE `entity_char` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `obj_id` integer NOT NULL,
    `val` varchar(255),
    UNIQUE (`cls_id`, `met_id`, `obj_id`)
)
;
CREATE TABLE `entity_text` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `obj_id` integer NOT NULL,
    `val` longtext,
    UNIQUE (`cls_id`, `met_id`, `obj_id`)
)
;
CREATE TABLE `entity_char_uniq` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `obj_id` integer NOT NULL,
    `val` varchar(255),
    UNIQUE (`cls_id`, `met_id`, `obj_id`),
    UNIQUE (`cls_id`, `met_id`, `val`)
)
;
CREATE TABLE `entity_combo` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `obj_id` integer NOT NULL,
    `com_id` integer NOT NULL,
    UNIQUE (`cls_id`, `met_id`, `obj_id`)
)
;
CREATE TABLE `entity_combo_content` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `met_id` integer NOT NULL,
    `val` varchar(255) NOT NULL,
    UNIQUE (`cls_id`, `met_id`, `val`)
)
;
CREATE TABLE `entity_bulk_add` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `cls_id` integer NOT NULL,
    `fname` varchar(255) NOT NULL,
    `due_date` datetime NOT NULL,
    `desc` longtext,
    `abs_fname` varchar(255) NOT NULL,
    `state` integer NOT NULL
)
;
COMMIT;